< previous page page_362 next page >

Page 362
4. At this position, you will be adding a string constant that contains a comma and a blank (, ). You will need to type this in yourself. Then add another + after the string.
5. Find the State field in the Fields list box and double-click it to add it to the formula. This is assuming that the State field is two characters; if you are not sure, you should also trim the field.
6. Now, you will be adding another string constant that contains two blanks ( ), which will position the Zip field properly. You will need to type this in yourself. Remember to add a + before and after the string.
7. Finally, add the Zip field to the formula, and click the Check button to verify that there are no errors in the formula. The formula should be the same as this:
8694cbadb9b1ef7075903f6f95fc1db2.gif
TrimRight ({Entry.City}) + ,  + { Entry.State} +   + { Entry.Zip}
8694cbadb9b1ef7075903f6f95fc1db2.gif
If there are no errors, click the Accept button to place the new field in your report.
Note
Every formula is create the same way. The only difference is the complexity of the formula.

Depending on what type of field you are formatting, you can either right-click the field to see the pop-up menu, or if the field is a string, you need to create a calculated field that adds the required information. If the phone number fields were strings, you would need to create a formula that resembles this one:
( + {Publishers.Telephone}[1 to 3] + )  + {Publishers.Telephone}[4 to 6]
 + - + {Publishers.Telephone}[7 to 10]
If the phone number is defined as a numeric field, you would first have to convert it to a string and then create the preceding formula. However, if you use a string, you could force the user to enter the formatted string by using the MaskedEditBox control and include the literal characters with the text.
After you have made all the changes discussed, the report should resemble the one shown in Figure 13.18.
The last thing you must do is save the report so you can access it from your Visual Basic application.

 
< previous page page_362 next page >

If you like this book, buy it!